<template>
  <div class="category">
    <ly-tabs
      class="tabs"
      :lineHeight="lineHeight"
      activeColor="#fff"
      @change="test"
    >
      <ly-tab-item
        :class="{ item: index == $store.state.index }"
        v-for="(item, index) in tabList"
        :key="item.id"
        :name="index"
        :title="item.tit"
        
      />
    </ly-tabs>
    <div class="sort-name">
      <a href="">
        <i class="iconfont icon-fenlei"></i>
        <span>分类</span>
      </a>
    </div>
    <div style="clear: both"></div>
  </div>
</template>

<script>
export default {
  data() {
    //这里存放数据
    return {
      lineHeight: 0,
      tabList: [
        {
          id: "001",
          tit: "首页",
          url: "",
        },
        {
          id: "002",
          tit: "家用电器",
          url: "",
        },
        {
          id: "003",
          tit: "男装女装",
          url: "",
        },
        {
          id: "004",
          tit: "鞋靴箱包",
          url: "",
        },
        {
          id: "005",
          tit: "手机数码",
          url: "",
        },
        {
          id: "006",
          tit: "电脑办公",
          url: "",
        },
        {
          id: "007",
          tit: "家居家纺",
          url: "",
        },
        {
          id: "008",
          tit: "个人化妆",
          url: "",
        },
        {
          id: "009",
          tit: "休闲运动",
          url: "",
        },
      ],
    };
  },
  mounted () {
  },
  components: {},
  methods: {
    test(i) {
      window.scrollTo(0,0)
      this.$store.commit("CHANGEINDEX", i);
    },
  },
};
</script>

<style lang="less" scoped>
.ly-tabs {
  border: none !important;
  background-color: transparent;
}
.category {
  width: 100%;
  display: flex;
  // background-color: #e43124;
  color: #fff;
  // position: fixed;
  // top: 4.4rem;
  position: relative;
  z-index: 3;
  .tabs {
    // flex-shrink: 1;
    // flex-grow: 1;
    // flex-basis: 0;
    flex: 1;
    .item {
      position: relative;
    }
    .item::after {
      content: " ";
      position: absolute;
      width: 12px;
      height: 6px;
      border-radius: 0 0 50% 50%/0 0 100% 100%;
      bottom: 0;
      left: calc(50% - 0.75rem);
      border: 2px solid #fff;
      border-top: none;
    }
  }
  .sort-name {
    width: 6rem;
    text-align: center;
    line-height: 4rem;
    font-size: 1.4rem;
    position: relative;
    z-index: 9;
    a {
      color: #fff;
      padding-left: 1rem;
      box-shadow: -4px 0 3px -2px rgb(0 0 0 / 40%);
    }
  }
}
</style>